﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class member_customermodify : System.Web.UI.Page
{
	public string EnterpriseName = "";
    public string UserID = "";
    public string UserPower = "";
    public string Footer = "";
	
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Init.islogin(ref UserID,ref EnterpriseName,ref UserPower))
        {
            Response.Redirect("/Login.aspx");
        }        
        if (!UserPower.Contains("Manager"))
        {
            Response.Write("你没有权限！");
            Response.End();
        }
        this.EnableViewState = false;
        string id = Request.Params["id"];
        list(id);
        _id.Text = id;
        Response.Write(Init.InitDefault());
    }
    Common Init = new Common();
    MsSqlHelper mssql = new MsSqlHelper();
    public void list(string id="")
    {
        string sql = "select * from mchk(nolock) where beactive='是' and dwbh='"+id+"'";
        if (Init.IsDebug)
        {
            ResultDeBug.Text = sql;
        }
        DataSet ds=mssql.ExecuteDs(sql);
        if (ds.Tables[0].Rows.Count != 0)
        {
            danwbh.Text=ds.Tables[0].Rows[0]["danwbh"].ToString();
            dwmch.Text = ds.Tables[0].Rows[0]["dwmch"].ToString();
            isjh.Text = ds.Tables[0].Rows[0]["isjh"].ToString();
            isxs.Text = ds.Tables[0].Rows[0]["isxs"].ToString();
            lxr.Text = ds.Tables[0].Rows[0]["lxr"].ToString();
            lxrdh.Text = ds.Tables[0].Rows[0]["lxrdh"].ToString();
            dzhdh.Text = ds.Tables[0].Rows[0]["dzhdh"].ToString();
            string imgyyzz = "";
            string imgypzlgf = "";
            string imggspzs = "";
            string imgzlbzxy = "";
            string imgyzyp = "";
            string imgfpyz = "";
            string imgyinzhang = "";
            string imgfrwts = "";
            string imgbwtrsfz = "";
            string imgkhxkz = "";
            string imgzlbznldcb = "";
            string imgdwbgjl = "";
            string imgkpxx = "";
            string imgdbthxkpj = "";
            string imgyljgzyxkz = "";
            string imgylqxjyxkz = "";
            string imgspltxkz = "";
            string imgqyndgsb = "";
            string imgswdlz = "";
            string imghetong = "";
            string mxsql="select rtrim(imageid) as imageid,rtrim(url) as url,rtrim(type_id) as type_id from [ImageDoc](nolock) where detailid='"+id+"'";
            //gspzs.Text = mxsql;
            DataSet dsmx=mssql.ExecuteDs(mxsql);
            if (dsmx.Tables[0].Rows.Count != 0) {				
                for (int i = 0; i < dsmx.Tables[0].Rows.Count; i++)
                {
                    string fileurl = Init.imagefileurl(dsmx.Tables[0].Rows[i]["url"].ToString());
                    imgyyzz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "yyzz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "yyzz") : "";
                    imgypzlgf += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "ypzlgf") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "ypzlgf") : "";
                    imggspzs += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "gspzs") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "gspzs") : "";
                    imgzlbzxy += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "zlbzxy") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "zlbzxy") : "";
                    imgyzyp += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "yzyp") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "yzyp") : "";
                    imgfpyz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "fpyz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "fpyz") : "";
                    imgyinzhang += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "yinzhang") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "yinzhang") : "";
                    imgfrwts += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "frwts") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "frwts") : "";
                    imgbwtrsfz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "bwtrsfz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "bwtrsfz") : "";
                    imgkhxkz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "khxkz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "khxkz") : "";
                    imgzlbznldcb += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "zlbznldcb") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "zlbznldcb") : "";
                    imgdwbgjl += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "dwbgjl") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "dwbgjl") : "";
                    imgkpxx += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "kpxx") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "kpxx") : "";
                    imgdbthxkpj += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "dbthxkpj") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "dbthxkpj") : "";
                    imgyljgzyxkz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "yljgzyxkz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "yljgzyxkz") : "";
                    imgylqxjyxkz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "ylqxjyxkz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "ylqxjyxkz") : "";
                    imgspltxkz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "spltxkz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "spltxkz") : "";
                    imgqyndgsb += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "qyndgsb") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "qyndgsb") : "";
                    imgswdlz += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "swdlz") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "swdlz") : "";
                    imghetong += (dsmx.Tables[0].Rows[i]["type_id"].ToString() == "hetong") ? li(dsmx.Tables[0].Rows[i]["imageid"].ToString(),fileurl, "hetong") : "";
                }
            }
            yyzz.Text = imgyyzz;
            ypzlgf.Text = imgypzlgf;
            gspzs.Text = imggspzs;
            zlbzxy.Text = imgzlbzxy;
            yzyp.Text = imgyzyp;
            fpyz.Text = imgfpyz;
            yinzhang.Text = imgyinzhang;
            frwts.Text = imgfrwts;
            bwtrsfz.Text = imgbwtrsfz;
            khxkz.Text = imgkhxkz;
            zlbznldcb.Text = imgzlbznldcb;
            dwbgjl.Text = imgdwbgjl;
            kpxx.Text = imgkpxx;
            dbthxkpj.Text = imgdbthxkpj;
            yljgzyxkz.Text = imgyljgzyxkz;
            ylqxjyxkz.Text = imgylqxjyxkz;
            spltxkz.Text = imgspltxkz;
            qyndgsb.Text = imgqyndgsb;
            swdlz.Text = imgswdlz;
            hetong.Text = imghetong;
        }
    }

    public string li(string imageid,string url,string datatype)
    {
        return "<li><span><img src=\"" + url + "\"></span><em data-type=\""+datatype+"\" data-id=\""+imageid+"\"><img src=\"/Public/Home/images/close.png\"></em></li>";
    }
}